package 美团笔试;

import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Scanner;

/**
 @author fujiangnan
 @create 2021-09-25-15-43
 @desc ...
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        long[] arr = new long[len];
        long m = sc.nextInt();
        for (int i = 0; i < len; i++) {
            arr[i] = sc.nextLong();
        }
        long ans = method(arr, m);
        System.out.println(ans);
    }
    public static long method(long[] arr, long m) {
        Arrays.sort(arr);

        while (m > 0) {
            long minValue = arr[0];
            for (int i = 0; i < arr.length; i++) {
                if (arr[i] == minValue && m > 0) {
                    --m;
                    ++arr[i];
                }
            }
            Arrays.sort(arr);
        }
        return arr[0];
    }
}
